import datetime

# 时间戳和datetime.datetime对象之间的转换
timestamp = datetime.datetime.now().timestamp()
date = datetime.datetime.fromtimestamp(timestamp)

# 时间戳和字符串之间的转换
timestamp2 = datetime.datetime.now().timestamp()
date2 = datetime.datetime.fromtimestamp(timestamp2)
str2 = date.strftime('%Y-%m-%d %H:%M:%S')
datestamp = datetime.datetime.strptime(str2, '%Y-%m-%d %H:%M:%S')
timestamp4 = datestamp.timestamp()

# 字符串和datetime之间的转换
str3 = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
date3 = datetime.datetime.strptime(str3, '%Y-%m-%d %H:%M:%S')

# 函数get_date()
def get_date(day_delta):
    print(datetime.datetime.now() + datetime.timedelta(days=day_delta))


get_date(-1)
